package com.briup.srms.base.service;

import com.briup.srms.base.bean.BaseUser;
import com.briup.srms.base.bean.extend.BaseUserExtend;
import com.jacky.base.utils.CustomerException;
import com.jacky.base.utils.PageVM;
import com.briup.srms.base.vm.UserVM;

import java.util.List;

/**
 * @program: 杰普基础管理系统
 * @description: 用户接口
 * @author: charles
 * @create: 2020-11-15 15:17
 **/

public interface IBaseUserService {
	// 保存用户级联角色
	void addUserWidthRole(BaseUser user, long roleId) throws CustomerException;

	// 更新用户头像
	void alterUserface(long id, String userface) throws CustomerException;

	// 分页查询
	PageVM<BaseUser> pageQuery(int page, int pageSize, String username, String roleName);

	// 批量插入
	void batchInsert(List<BaseUser> list) throws CustomerException;

	/**
	 * @Description: 登录
	 * @Param: [userVM]
	 * @return: void
	 * @Author: charles
	 * @Date: 2020-11-18
	 */
	BaseUser login(UserVM userVM) throws CustomerException;

	/**
	 * @Description: 通过id查询
	 * @Param: [id]
	 * @return: com.briup.srms.base.bean.extend.BaseUserExtend
	 * @Author: charles
	 * @Date: 2020-11-16
	 */
	BaseUserExtend findById(long id);

	/**
	 * @Description: 查询所有
	 * @Param: []
	 * @return: java.util.List<com.briup.srms.base.bean.BaseUser>
	 * @Author: charles
	 * @Date: 2020-11-16
	 */
	List<BaseUser> findAll();

	/**
	 * @Description: 级联查询所有
	 * @Param: []
	 * @return: java.util.List<com.briup.srms.base.bean.extend.BaseUserExtend>
	 * @Author: charles
	 * @Date: 2020-11-17
	 */
	List<BaseUserExtend> cascadeRoleFindAll();

	/**
	 * @Description: 保存或更新
	 * @Param: [baseUser]
	 * @return: void
	 * @Author: charles
	 * @Date: 2020-11-16
	 */
	void saveOrUpdate(BaseUser baseUser) throws CustomerException;

	/**
	 * @Description: 更新状态
	 * @Param: [status]
	 * @return: void
	 * @Author: charles
	 * @Date: 2020-11-16
	 */
	void changeStatus(long id, String status) throws CustomerException;

	/**
	 * @Description: 通过id删除
	 * @Param: [id]
	 * @return: void
	 * @Author: charles
	 * @Date: 2020-11-17
	 */
	void deleteById(long id) throws CustomerException;

	/**
	 * @Description: 设置角色
	 * @Param: [id, roles]
	 * @return: void
	 * @Author: charles
	 * @Date: 2020-11-17
	 */
	void setRoles(long id, List<Long> roles);
}
